layout (location = 0) out vec4 eceGlPosition;
layout (location = 1) out vec4 eceGlNormal;
layout (location = 2) out vec4 eceGlAlbedoSpec;
layout (location = 3) out vec4 eceGlGameData;

uniform ece_Material material1;
uniform ece_Material material2;
uniform sampler2D texture1;
uniform sampler2D texture2;
varying vec2 vTexCoord;
varying float vTexAlpha;
varying vec3 vNormal;
varying vec3 vPosition;
varying float vDistance;
void main() {
	vec4 baseColor1 = texture2D(texture1, vTexCoord);
	vec4 baseColor2 = texture2D(texture2, vTexCoord);
	vec4 baseColor = mix(baseColor2, baseColor1, vTexAlpha);
	
	ece_Material material;
	material.enable = true;
	material.diffuse = mix(material1.diffuse, material2.diffuse, vTexAlpha);
	material.specular = mix(material1.specular, material2.specular, vTexAlpha);
	material.shininess = mix(material1.shininess, material2.shininess, vTexAlpha);
	
	eceGlPosition.rgb = vPosition;
	eceGlPosition.a = vDistance;
	eceGlNormal.rgb = vNormal;
	eceGlNormal.a = material.enable ? material.shininess : 24;
	eceGlAlbedoSpec.rgb = material.enable ? baseColor.rgb * material.diffuse : baseColor.rgb;
	eceGlAlbedoSpec.a = material.specular.r;
	//可以进行贴花
	eceGlGameData.r = 1.0;
}